package node;

/**
 * @author Yakiv Tymoshenko
 * @since 14.10.12
 */
public class Node {

    private int index;
    private Object key;
    private Node parent;
    private Node left;
    private Node right;

    public Node(int index, Object key) {
        this(index, key, null, null, null);
    }

    public Node(int index, Object key, Node parent, Node left, Node right) {
        this.index = index;
        this.key = key;
        this.parent = parent;
        this.left = left;
        this.right = right;
    }

    @Override
    public String toString() {
        return String.valueOf(index);
    }

    public int getIndex() {
        return index;
    }

    public Object getKey() {
        return key;
    }

    public Node getParent() {
        return parent;
    }

    public void setParent(Node parent) {
        this.parent = parent;
    }

    public Node getLeft() {
        return left;
    }

    public void setLeft(Node left) {
        this.left = left;
    }

    public Node getRight() {
        return right;
    }

    public void setRight(Node right) {
        this.right = right;
    }
}
